Learn about javascript get number of days in month, we have the largest and most updated javascript get number of days in month information on alibabacloud.com
Original link: http://www.jb51.net/article/44468.htm
First, get the last day of the month (possibly 28/29/30/21) problem, the idea is simply to get the first day of the next month, the number of milliseconds from 1970, and then subtract the number
title page
function Getlastday (year,month)
{
var new_year = year; Take the current year
var new_month = month++;//Remove the first day of one months to facilitate calculation (last day is not fixed)
if (month>12) //If
JS How to get the number of days for a specified month:Sometimes you need to get the number of days in a given year of January, because the number of days per month is different, and the number of days is different for one months, for example, in
The example of this article is about how to get the last days of month, the maximum days and the number of days. Share to everyone for your reference, specific as follows:
title page
function Getlastday (year,month)
{
var new_year =
From: http://blog.csdn.net/sproy/article/details/6505144
The new date ("xxxx/XX/xx") Construction Method in Javascript has a wonderful effect. When you input "xxxx/XX/0" (0) the date obtained is the last day of the previous month of the month (the
During registration, the number of days of the month changes with the change of the month. this small function is used in many places! & Lt; 5 & gt; change PHP code [php] & lt; selectname & quot; month & quot; id & quot; month & quot; onchange &
The new date ("xxxx/XX/xx") Construction Method in Javascript has a wonderful effect. When you input "xxxx/XX/0" (0) the date obtained is the last day of the previous month of the month (the maximum value of the Month of "XX" is 69. If "" is input ",
Q: How does the daily script calculate the number of days in a specified month?A: In this case ....
1: function daysInMonth(iMonth, iYear)
2: {
3: return 32 - new Date(iYear, iMonth, 32).getDate();
4: }
As for why, you may
The general practice is to first determine the number of months, and then determine the number of days (usually with a switch), if it is February, You have to determine whether the selected year is a leap year, then decide whether it is 28 days or 29
When using JS to draw a working calendar, you need to use JS to calculate the total number of days of the specified monthOn the Internet to find some methods, are more cumbersome, and later brainwave, think of a lazy way to shareFirst, the principle
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.